package com.cyy.controller;

import com.cyy.domain.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author CYY
 * @since 2022/5/19
 */
//@Controller
//@ResponseBody
@RestController
@RequestMapping("books")
public class BookController {

    //@RequestMapping(method = RequestMethod.POST)
    @PostMapping
    public String save(){
        System.out.println("books save...");
        return "{'module':'books save'}";
    }

    //@RequestMapping(value = "/{id}",method = RequestMethod.DELETE)
    @DeleteMapping("{id}")
    public String delete(@PathVariable Integer id){
        System.out.println("books delete..."+id);
        return "{'module':'books delete'}";
    }

    // @RequestMapping(method = RequestMethod.PUT)
    @PutMapping
    public String update(@RequestBody User user){
        System.out.println("books update..."+user);
        return "{'module':'books update'}";
    }

    //@RequestMapping(value = "/{id}",method = RequestMethod.GET)
    @GetMapping("{id}")
    public String getByID(@PathVariable Integer id){
        System.out.println("books getById..."+id);
        return "{'module':'books getById'}";
    }


    //@RequestMapping(method = RequestMethod.GET)
    @GetMapping
    public String getAll(){
        System.out.println("books getAll...");
        return "{'module':'books getAll'}";
    }
}